const express=require('express');
var jade=require('jade');
var bodyParser = require('body-parser');
var loginRouter=require('./routes/login');
var indexRouter = require('./routes/index');
var aritcleRouter=require('./routes/aritcle.js');
var lableRouter=require('./routes/lable.js');
var contentRouter = require('./routes/content');
var recycleRouter = require('./routes/recycle');
var userRouter = require('./routes/user');
var commentRouter = require('./routes/comment');
var FriendRouter = require('./routes/FriendChain.js');
var CollectionRouter = require('./routes/Collection.js');
var ThumbsUpRouter= require('./routes/ThumbsUp.js');
var session = require('express-session');
var ueditor = require("ueditor")
var path=require('path');


var app = express();
var ejs = require('ejs');
app.engine('html', ejs.__express);
app.set('view engine', 'html');
app.use(session({
  secret: 'secret', // 对session id 相关的cookie 进行签名
  resave: true,
  saveUninitialized: false, // 是否保存未初始化的会话
  cookie: {
    maxAge: 1000 * 60 * 60 * 60, // 设置 session 的有效时间，单位毫秒
  }
}));

app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())
app.use(express.static('public'));
app.use(express.static('public/images/'));
app.use('/js',express.static('public/js/'));
app.use('/img',express.static('public/img/'));
app.use('/', indexRouter);
app.use('/login', loginRouter);
app.use('/aritcle',aritcleRouter);
app.use('/lable',lableRouter);
app.use('/content',contentRouter);
app.use('/recycle',recycleRouter);
app.use('/user',userRouter);
app.use('/comment',commentRouter);
app.use('/friend',FriendRouter);
app.use('/Collection',CollectionRouter);
app.use('/ThumbsUp',ThumbsUpRouter);
require('./db/connect.js');
module.exports =app;
